//
//	ZKReadModel.m
//	Model file generated using JSONExport: https://github.com/Ahmed-Ali/JSONExport



#import "ZKReadModel.h"

@interface ZKReadModel ()
@end
@implementation ZKReadModel




/**
 * Instantiate the instance using the passed dictionary values to set the properties values
 */

-(instancetype)initWithDictionary:(NSDictionary *)dictionary
{
	if(dictionary == nil || [dictionary isKindOfClass:[NSNull class]]){
		return nil;
	}
	self = [super init];

	if(![dictionary[@"data"] isKindOfClass:[NSNull class]]){
		self.data = [[ZKReadData alloc] initWithDictionary:dictionary[@"data"]];
	}

	if(![dictionary[@"msg"] isKindOfClass:[NSNull class]]){
		self.msg = dictionary[@"msg"];
	}

	if(![dictionary[@"stat"] isKindOfClass:[NSNull class]]){
		self.stat = dictionary[@"stat"];
	}

	return self;
}


/**
 * Returns all the available property values in the form of NSDictionary object where the key is the approperiate json key and the value is the value of the corresponding property
 */
-(NSDictionary *)toDictionary
{
	NSMutableDictionary * dictionary = [NSMutableDictionary dictionary];
	if(self.data != nil){
		dictionary[@"data"] = [self.data toDictionary];
	}
	if(self.msg != nil){
		dictionary[@"msg"] = self.msg;
	}
	if(self.stat != nil){
		dictionary[@"stat"] = self.stat;
	}
	return dictionary;

}

/**
 * Implementation of NSCoding encoding method
 */
/**
 * Returns all the available property values in the form of NSDictionary object where the key is the approperiate json key and the value is the value of the corresponding property
 */
- (void)encodeWithCoder:(NSCoder *)aCoder
{
	if(self.data != nil){
		[aCoder encodeObject:self.data forKey:@"data"];
	}
	if(self.msg != nil){
		[aCoder encodeObject:self.msg forKey:@"msg"];
	}
	if(self.stat != nil){
		[aCoder encodeObject:self.stat forKey:@"stat"];
	}

}

/**
 * Implementation of NSCoding initWithCoder: method
 */
- (instancetype)initWithCoder:(NSCoder *)aDecoder
{
	self = [super init];
	self.data = [aDecoder decodeObjectForKey:@"data"];
	self.msg = [aDecoder decodeObjectForKey:@"msg"];
	self.stat = [aDecoder decodeObjectForKey:@"stat"];
	return self;

}
@end



@interface ZKReadData ()
@end
@implementation ZKReadData




/**
 * Instantiate the instance using the passed dictionary values to set the properties values
 */

-(instancetype)initWithDictionary:(NSDictionary *)dictionary
{
    if(dictionary == nil || [dictionary isKindOfClass:[NSNull class]]){
        return nil;
    }
    self = [super init];
    
    if(![dictionary[@"zKReadModel"] isKindOfClass:[NSNull class]]){
        self.zKReadModel = [[ZKReadModel alloc] initWithDictionary:dictionary[@"zKReadModel"]];
    }
    
    if(![dictionary[@"ad_url"] isKindOfClass:[NSNull class]]){
        self.adUrl = dictionary[@"ad_url"];
    }
    
    if(![dictionary[@"content"] isKindOfClass:[NSNull class]]){
        self.content = dictionary[@"content"];
    }
    
    if(![dictionary[@"content_format"] isKindOfClass:[NSNull class]]){
        self.contentFormat = dictionary[@"content_format"];
    }
    
    if(![dictionary[@"disclaimer"] isKindOfClass:[NSNull class]]){
        self.disclaimer = dictionary[@"disclaimer"];
    }
    
    if(![dictionary[@"js_ref"] isKindOfClass:[NSNull class]]){        
        NSArray * mediaDictionaries = dictionary[@"js_ref"];
        RLMArray * mediaItems = [[RLMArray alloc] initWithObjectClassName:[RLMString className]];
        for(NSString *str in mediaDictionaries){
            RLMString * mediaItem = [[RLMString alloc] initWithString:str];
            [mediaItems addObject:mediaItem];
        }
        self.jsRef = (RLMArray<RLMString> *)mediaItems;
    }
    
    if(dictionary[@"media"] != nil && ![dictionary[@"media"] isKindOfClass:[NSNull class]]){
        NSArray * mediaDictionaries = dictionary[@"media"];
        RLMArray * mediaItems = [[RLMArray alloc] initWithObjectClassName:[ZKReadMedia className]];
        for(NSDictionary * mediaDictionary in mediaDictionaries){
            ZKReadMedia * mediaItem = [[ZKReadMedia alloc] initWithDictionary:mediaDictionary];
            [mediaItems addObject:mediaItem];
        }
        self.media = (RLMArray<ZKReadMedia> *)mediaItems;
    }
    if(![dictionary[@"pk"] isKindOfClass:[NSNull class]]){
        self.pk = dictionary[@"pk"];
    }
    
    if(dictionary[@"tpl_medias"] != nil && ![dictionary[@"tpl_medias"] isKindOfClass:[NSNull class]]){
        NSArray * tplMediasDictionaries = dictionary[@"tpl_medias"];
        RLMArray * tplMediasItems = [[RLMArray alloc] initWithObjectClassName:[ZKReadTplMedia className]];
        for(NSDictionary * tplMediasDictionary in tplMediasDictionaries){
            ZKReadTplMedia * tplMediasItem = [[ZKReadTplMedia alloc] initWithDictionary:tplMediasDictionary];
            [tplMediasItems addObject:tplMediasItem];
        }
        self.tplMedias = (RLMArray<ZKReadTplMedia> *)tplMediasItems;
    }
    return self;
}


/**
 * Returns all the available property values in the form of NSDictionary object where the key is the approperiate json key and the value is the value of the corresponding property
 */
-(NSDictionary *)toDictionary
{
    NSMutableDictionary * dictionary = [NSMutableDictionary dictionary];
    if(self.zKReadModel != nil){
        dictionary[@"zKReadModel"] = [self.zKReadModel toDictionary];
    }
    if(self.adUrl != nil){
        dictionary[@"ad_url"] = self.adUrl;
    }
    if(self.content != nil){
        dictionary[@"content"] = self.content;
    }
    if(self.contentFormat != nil){
        dictionary[@"content_format"] = self.contentFormat;
    }
    if(self.disclaimer != nil){
        dictionary[@"disclaimer"] = self.disclaimer;
    }
    if(self.jsRef != nil){
        dictionary[@"js_ref"] = self.jsRef;
    }
    if(self.media != nil){
        NSMutableArray * dictionaryElements = [NSMutableArray array];
        for(ZKReadMedia * mediaElement in self.media){
            [dictionaryElements addObject:[mediaElement toDictionary]];
        }
        dictionary[@"media"] = dictionaryElements;
    }
    if(self.pk != nil){
        dictionary[@"pk"] = self.pk;
    }
    if(self.tplMedias != nil){
        NSMutableArray * dictionaryElements = [NSMutableArray array];
        for(ZKReadTplMedia * tplMediasElement in self.tplMedias){
            [dictionaryElements addObject:[tplMediasElement toDictionary]];
        }
        dictionary[@"tpl_medias"] = dictionaryElements;
    }
    return dictionary;
    
}

/**
 * Implementation of NSCoding encoding method
 */
/**
 * Returns all the available property values in the form of NSDictionary object where the key is the approperiate json key and the value is the value of the corresponding property
 */
- (void)encodeWithCoder:(NSCoder *)aCoder
{
    if(self.zKReadModel != nil){
        [aCoder encodeObject:self.zKReadModel forKey:@"zKReadModel"];
    }
    if(self.adUrl != nil){
        [aCoder encodeObject:self.adUrl forKey:@"ad_url"];
    }
    if(self.content != nil){
        [aCoder encodeObject:self.content forKey:@"content"];
    }
    if(self.contentFormat != nil){
        [aCoder encodeObject:self.contentFormat forKey:@"content_format"];
    }
    if(self.disclaimer != nil){
        [aCoder encodeObject:self.disclaimer forKey:@"disclaimer"];
    }
    if(self.jsRef != nil){
        [aCoder encodeObject:self.jsRef forKey:@"js_ref"];
    }
    if(self.media != nil){
        [aCoder encodeObject:self.media forKey:@"media"];
    }
    if(self.pk != nil){
        [aCoder encodeObject:self.pk forKey:@"pk"];
    }
    if(self.tplMedias != nil){
        [aCoder encodeObject:self.tplMedias forKey:@"tpl_medias"];
    }
    
}

/**
 * Implementation of NSCoding initWithCoder: method
 */
- (instancetype)initWithCoder:(NSCoder *)aDecoder
{
    self = [super init];
    self.zKReadModel = [aDecoder decodeObjectForKey:@"zKReadModel"];
    self.adUrl = [aDecoder decodeObjectForKey:@"ad_url"];
    self.content = [aDecoder decodeObjectForKey:@"content"];
    self.contentFormat = [aDecoder decodeObjectForKey:@"content_format"];
    self.disclaimer = [aDecoder decodeObjectForKey:@"disclaimer"];
    self.jsRef = [aDecoder decodeObjectForKey:@"js_ref"];
    self.media = [aDecoder decodeObjectForKey:@"media"];
    self.pk = [aDecoder decodeObjectForKey:@"pk"];
    self.tplMedias = [aDecoder decodeObjectForKey:@"tpl_medias"];
    return self;
    
}
@end



@interface ZKReadMedia ()
@end
@implementation ZKReadMedia




/**
 * Instantiate the instance using the passed dictionary values to set the properties values
 */

-(instancetype)initWithDictionary:(NSDictionary *)dictionary
{
    if(dictionary == nil || [dictionary isKindOfClass:[NSNull class]]){
        return nil;
    }
    self = [super init];
    
    if(![dictionary[@"zKReadData"] isKindOfClass:[NSNull class]]){
        self.zKReadData = [[ZKReadData alloc] initWithDictionary:dictionary[@"zKReadData"]];
    }
    
    if(![dictionary[@"h"] isKindOfClass:[NSNull class]]){
        self.h = dictionary[@"h"];
    }
    
    if(![dictionary[@"id"] isKindOfClass:[NSNull class]]){
        self.idField = dictionary[@"id"];
    }
    
    if(![dictionary[@"m_url"] isKindOfClass:[NSNull class]]){
        self.mUrl = dictionary[@"m_url"];
    }
    
    if(![dictionary[@"min_url"] isKindOfClass:[NSNull class]]){
        self.minUrl = dictionary[@"min_url"];
    }
    
    if(![dictionary[@"raw_url"] isKindOfClass:[NSNull class]]){
        self.rawUrl = dictionary[@"raw_url"];
    }
    
    if(![dictionary[@"type"] isKindOfClass:[NSNull class]]){
        self.type = dictionary[@"type"];
    }
    
    if(![dictionary[@"url"] isKindOfClass:[NSNull class]]){
        self.url = dictionary[@"url"];
    }
    
    if(![dictionary[@"w"] isKindOfClass:[NSNull class]]){
        self.w = dictionary[@"w"];
    }
    
    return self;
}


/**
 * Returns all the available property values in the form of NSDictionary object where the key is the approperiate json key and the value is the value of the corresponding property
 */
-(NSDictionary *)toDictionary
{
    NSMutableDictionary * dictionary = [NSMutableDictionary dictionary];
    if(self.zKReadData != nil){
        dictionary[@"zKReadData"] = [self.zKReadData toDictionary];
    }
    if(self.h != nil){
        dictionary[@"h"] = self.h;
    }
    if(self.idField != nil){
        dictionary[@"id"] = self.idField;
    }
    if(self.mUrl != nil){
        dictionary[@"m_url"] = self.mUrl;
    }
    if(self.minUrl != nil){
        dictionary[@"min_url"] = self.minUrl;
    }
    if(self.rawUrl != nil){
        dictionary[@"raw_url"] = self.rawUrl;
    }
    if(self.type != nil){
        dictionary[@"type"] = self.type;
    }
    if(self.url != nil){
        dictionary[@"url"] = self.url;
    }
    if(self.w != nil){
        dictionary[@"w"] = self.w;
    }
    return dictionary;
    
}

/**
 * Implementation of NSCoding encoding method
 */
/**
 * Returns all the available property values in the form of NSDictionary object where the key is the approperiate json key and the value is the value of the corresponding property
 */
- (void)encodeWithCoder:(NSCoder *)aCoder
{
    if(self.zKReadData != nil){
        [aCoder encodeObject:self.zKReadData forKey:@"zKReadData"];
    }
    if(self.h != nil){
        [aCoder encodeObject:self.h forKey:@"h"];
    }
    if(self.idField != nil){
        [aCoder encodeObject:self.idField forKey:@"id"];
    }
    if(self.mUrl != nil){
        [aCoder encodeObject:self.mUrl forKey:@"m_url"];
    }
    if(self.minUrl != nil){
        [aCoder encodeObject:self.minUrl forKey:@"min_url"];
    }
    if(self.rawUrl != nil){
        [aCoder encodeObject:self.rawUrl forKey:@"raw_url"];
    }
    if(self.type != nil){
        [aCoder encodeObject:self.type forKey:@"type"];
    }
    if(self.url != nil){
        [aCoder encodeObject:self.url forKey:@"url"];
    }
    if(self.w != nil){
        [aCoder encodeObject:self.w forKey:@"w"];
    }
    
}

/**
 * Implementation of NSCoding initWithCoder: method
 */
- (instancetype)initWithCoder:(NSCoder *)aDecoder
{
    self = [super init];
    self.zKReadData = [aDecoder decodeObjectForKey:@"zKReadData"];
    self.h = [aDecoder decodeObjectForKey:@"h"];
    self.idField = [aDecoder decodeObjectForKey:@"id"];
    self.mUrl = [aDecoder decodeObjectForKey:@"m_url"];
    self.minUrl = [aDecoder decodeObjectForKey:@"min_url"];
    self.rawUrl = [aDecoder decodeObjectForKey:@"raw_url"];
    self.type = [aDecoder decodeObjectForKey:@"type"];
    self.url = [aDecoder decodeObjectForKey:@"url"];
    self.w = [aDecoder decodeObjectForKey:@"w"];
    return self;
    
}
@end


@interface ZKReadTplMedia ()
@end
@implementation ZKReadTplMedia




/**
 * Instantiate the instance using the passed dictionary values to set the properties values
 */

-(instancetype)initWithDictionary:(NSDictionary *)dictionary
{
    if(dictionary == nil || [dictionary isKindOfClass:[NSNull class]]){
        return nil;
    }
    self = [super init];
    
    if(![dictionary[@"zKReadData"] isKindOfClass:[NSNull class]]){
        self.zKReadData = [[ZKReadData alloc] initWithDictionary:dictionary[@"zKReadData"]];
    }
    
    if(![dictionary[@"h"] isKindOfClass:[NSNull class]]){
        self.h = dictionary[@"h"];
    }
    
    if(![dictionary[@"id"] isKindOfClass:[NSNull class]]){
        self.idField = dictionary[@"id"];
    }
    
    if(![dictionary[@"m_url"] isKindOfClass:[NSNull class]]){
        self.mUrl = dictionary[@"m_url"];
    }
    
    if(![dictionary[@"min_url"] isKindOfClass:[NSNull class]]){
        self.minUrl = dictionary[@"min_url"];
    }
    
    if(![dictionary[@"raw_url"] isKindOfClass:[NSNull class]]){
        self.rawUrl = dictionary[@"raw_url"];
    }
    
    if(![dictionary[@"target"] isKindOfClass:[NSNull class]]){
        self.target = dictionary[@"target"];
    }
    
    if(![dictionary[@"type"] isKindOfClass:[NSNull class]]){
        self.type = dictionary[@"type"];
    }
    
    if(![dictionary[@"url"] isKindOfClass:[NSNull class]]){
        self.url = dictionary[@"url"];
    }
    
    if(![dictionary[@"w"] isKindOfClass:[NSNull class]]){
        self.w = dictionary[@"w"];
    }
    
    return self;
}


/**
 * Returns all the available property values in the form of NSDictionary object where the key is the approperiate json key and the value is the value of the corresponding property
 */
-(NSDictionary *)toDictionary
{
    NSMutableDictionary * dictionary = [NSMutableDictionary dictionary];
    if(self.zKReadData != nil){
        dictionary[@"zKReadData"] = [self.zKReadData toDictionary];
    }
    if(self.h != nil){
        dictionary[@"h"] = self.h;
    }
    if(self.idField != nil){
        dictionary[@"id"] = self.idField;
    }
    if(self.mUrl != nil){
        dictionary[@"m_url"] = self.mUrl;
    }
    if(self.minUrl != nil){
        dictionary[@"min_url"] = self.minUrl;
    }
    if(self.rawUrl != nil){
        dictionary[@"raw_url"] = self.rawUrl;
    }
    if(self.target != nil){
        dictionary[@"target"] = self.target;
    }
    if(self.type != nil){
        dictionary[@"type"] = self.type;
    }
    if(self.url != nil){
        dictionary[@"url"] = self.url;
    }
    if(self.w != nil){
        dictionary[@"w"] = self.w;
    }
    return dictionary;
    
}

/**
 * Implementation of NSCoding encoding method
 */
/**
 * Returns all the available property values in the form of NSDictionary object where the key is the approperiate json key and the value is the value of the corresponding property
 */
- (void)encodeWithCoder:(NSCoder *)aCoder
{
    if(self.zKReadData != nil){
        [aCoder encodeObject:self.zKReadData forKey:@"zKReadData"];
    }
    if(self.h != nil){
        [aCoder encodeObject:self.h forKey:@"h"];
    }
    if(self.idField != nil){
        [aCoder encodeObject:self.idField forKey:@"id"];
    }
    if(self.mUrl != nil){
        [aCoder encodeObject:self.mUrl forKey:@"m_url"];
    }
    if(self.minUrl != nil){
        [aCoder encodeObject:self.minUrl forKey:@"min_url"];
    }
    if(self.rawUrl != nil){
        [aCoder encodeObject:self.rawUrl forKey:@"raw_url"];
    }
    if(self.target != nil){
        [aCoder encodeObject:self.target forKey:@"target"];
    }
    if(self.type != nil){
        [aCoder encodeObject:self.type forKey:@"type"];
    }
    if(self.url != nil){
        [aCoder encodeObject:self.url forKey:@"url"];
    }
    if(self.w != nil){
        [aCoder encodeObject:self.w forKey:@"w"];
    }
    
}

/**
 * Implementation of NSCoding initWithCoder: method
 */
- (instancetype)initWithCoder:(NSCoder *)aDecoder
{
    self = [super init];
    self.zKReadData = [aDecoder decodeObjectForKey:@"zKReadData"];
    self.h = [aDecoder decodeObjectForKey:@"h"];
    self.idField = [aDecoder decodeObjectForKey:@"id"];
    self.mUrl = [aDecoder decodeObjectForKey:@"m_url"];
    self.minUrl = [aDecoder decodeObjectForKey:@"min_url"];
    self.rawUrl = [aDecoder decodeObjectForKey:@"raw_url"];
    self.target = [aDecoder decodeObjectForKey:@"target"];
    self.type = [aDecoder decodeObjectForKey:@"type"];
    self.url = [aDecoder decodeObjectForKey:@"url"];
    self.w = [aDecoder decodeObjectForKey:@"w"];
    return self;
    
}
@end



@interface RLMString()

@end

@implementation RLMString

-(instancetype)initWithString:(NSString*)string{
    self = [super init];
    if(self){
        self.value = string;
    }
    return self;
}

@end
